﻿#include <iostream>
#include "haskelltool.h"
#include "hobject.h"
#include "hfunction.h"
using namespace std;


std::string solveRPN(std::string str);
std::string solveRPN2(std::string str);
double solveStr(std::string str);
int main1()
{
    HaskellTool::words("1 2 \t  3 +    \n \t -");
    auto result = solveRPN2("12 3 -");
    std::cout << result<<endl;
    auto result2 = solveStr("2 - 4 * 2 + 8");
    std::cout << "result2="<<result2<<endl;
    return 0;
}


int main2()
{
    HObject obj1;
    obj1.value1 = 5;
    HObject obj2;
    obj2.value1 = 10;
    obj1 + obj2;
    fprintf(stderr, "obj1.value=%d\n", obj1.value1);

    HFunction f1;
    HObject obj3 = ((obj1 >>= f1) >>= f1) >>= f1;
    fprintf(stderr, "obj3.value=%d\n", obj3.value1);


    HObject obj4 = f1.run(obj3);
    fprintf(stderr, "obj4.value=%d\n", obj4.value1);


    FunType f2 = [](int x){return x + 2;};
    FunType f3 = [](int x){return x + 30000;};
    FunType f4 = [](int x){return x + 400000;};
    FunType f5 = [](int x){return x + 5000000;};
    HObject obj5 = obj4 >> f2 >> f3 >> f4 >>f5;
    fprintf(stderr, "obj5.value=%d\n", obj5.value1);

    return 0;
}

int main_barcode();
int main_barcode2();
int main_barcode3();
int main_barcode4();
int main()
{
    return main_barcode3();
}
